package br.unesp.rc.tcc.services.impl;

import java.util.ArrayList;
import java.util.List;

import br.unesp.rc.tcc.model.bean.Author;
import br.unesp.rc.tcc.services.AuthorServices;

//@Service
//@Scope(value = "singleton")
public class AuthorServicesImpl implements AuthorServices {
	
    /*@Autowired
    private AuthorDao authorDao;*/
	
	//@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
	@Override
	public Author findById(final Long id) {
		//Author author = authorDao.findById(id);
		Author author = new Author();
		author.setName("author nro. 1");
		author.setId(1);		
		
		return author;
	}
	
	//@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
	@Override
	public List<Author> findAll() {
		/*List<Student> studentList = new ArrayList<Student>();
		studentList.add(new Student(1L, "John", "Smith", new Date()));
		studentList.add(new Student(2L, "Larry", "Parker", new Date()));
		studentList.add(new Student(3L, "Brad", "Sanders", new Date()));
		return new StudentListTO(studentList);*/
		//return studentDao.find(studentId);
		//return null; 
		
		
		ArrayList<Author> names = new ArrayList<Author>();
		
		Author b1 = new Author();
		Author b2 = new Author();
		Author b3 = new Author();
		
		b1.setName("author nro. 1");
		b1.setId(0);
		b2.setName("author nro. 2");
		b2.setId(1);
		b3.setName("author nro. 3");
		b3.setId(2);
		
		names.add(b1);
		names.add(b2);
		names.add(b3);
		
		return names;
	}

}